package 算法.leetcode;

/**
 * @author:谢君臣
 * @Date:2021/8/21-22:15
 * @version:1.0
 * @function:
 */
public class lc62 {
    public static void main(String[] args) {
        System.out.println(uniquePaths(3, 7));
    }
    public static int uniquePaths(int m, int n) {
        int[][]dp = new int[m+1][n+1];
        for (int i = 0; i < n; i++) {
            dp[0][i] = 0;
        }
        for (int i = 0; i < m; i++) {
            dp[i][0] = 0;
        }
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n ; j++) {
                if (i==1&&j==1)
                    dp[i][j]=1;
                else
                    dp[i][j] = dp[i-1][j]+dp[i][j-1];
            }
        }
        return dp[m][n];
    }
}
